package com.clusterswisdom.horn.api.event;

import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.clusterswisdom.horn.api.ioc.event.HornEvent;

public class EventPool extends ThreadPoolExecutor {
	
	private static EventPool pool = new EventPool();
	
	public static EventPool getPool() {
		return pool;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public EventPool() {
		super(50, 100, 30, TimeUnit.SECONDS, new SynchronousQueue(), new ThreadPoolExecutor.AbortPolicy());
	}

	public void executeEvent(HornEvent event) {
		super.execute(new EventProcessor(event));
	}
}